package 位运算;

import java.util.Scanner;

public class 判断一的个数 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int sum = 0;
//        for (int i = 0; i < 32; i++) {
//            if ((n&(1 << i)) == (1 << i)){
//                sum ++;
//            }
//        }
        while (n!=0){
            n = ((n-1))&n;
            System.out.println(n);
            sum++;
        }
        System.out.println(Integer.toString(n,2));
        System.out.println(sum);
    }
}
